/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Database;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

/**
 *
 * @author Yohanes Beny P
 */
public class Koneksi {

    public static Connection open() {

//        String jdbcUrl="jdbc:oracle:thin:@172.23.9.185:1521:orcl";
//        String name="mhs115314002";
//        String pass="mhs115314002";

        String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:XE";
        String name = "rplt";
        String pass = "rplt";

        Connection conn = null;

        try {
            OracleDataSource ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            conn = ds.getConnection(name, pass);
            Statement stat = conn.createStatement();
            System.out.println("Koneksi berhasil");
        } catch (SQLException ex) {
            System.out.println("Koneksi gagal");
        }
        return conn;
    }
}
